home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13874 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  55 lines

  1. Newsgroups: comp.lang.c
  2. Path: owl3.office-workstations-ltd.co.uk!not-for-mail
  3. From: kenn@office-workstations-ltd.co.uk (Ken Nicolson)
  4. Subject: Re: Help to detect error
  5. Message-ID: <316bb36d.1950327@newshost>
  6. Date: Wed, 10 Apr 1996 13:17:55 GMT
  7. References: <DpMA82.KEE.0.bloor@torfree.net>
  8. Organization: Office Workstations Limited
  9. Reply-To: kenn@owl-uk.co.uk
  10. X-Newsreader: Forte Agent .99d/32.182
  11.  
  12. bz786@torfree.net (Sherif Asif) wrote:
  13.  
  14. >I am using unix compiler and I get the following error message
  15. >II am learing on my own please help me. Last time when I posted I got 
  16. >lots of reply . Thanks .
  17. >line 6: syntax error at or near type word "int"
  18. >line 20: syntax error at or near type word "int"
  19. >line 23: n undefined
  20. >line 25: syntax error at or near word "if"
  21. >line 26: x undefined
  22. >
  23. >#include <stdio.h>
  24. >/*reoder 1 dim array, int array from smallest to largest*/
  25. >main()
  26. >{
  27. >int i, n, x[100];
  28. >reorder (int n , int x[]); /* LINE 6 */
  29. Judging by your errors, I think you have a non-ANSI C compiler that only
  30. accepts old-style K&R-1 function declarations. I suggest you try to obtain
  31. a newer one.
  32.  
  33. However, if you cannot do this, you will need:
  34.  
  35. void reorder (); /* LINE 6 */
  36.  
  37. and
  38.  
  39. void reorder (n, x) /* LINE 20 */
  40. int n, x[];
  41. {
  42. ...
  43.  
  44. >for (i=item+1; i<n;++i/
  45.                        ^
  46. Should be ")"
  47. for (i=item+1; i<n;++i)
  48.  
  49. I've made the function void as you never return a value from it.
  50.  
  51. Hope this helps!
  52.  
  53. Ken
  54.  
  55.